#!/bin/bash

# 读取版本代码
echo "Input the codename"
read codename 

# 调整分辨率
xrandr --size 1280x960

# 修改软件源
cp /etc/apt/sources.list /etc/apt/sources.list.copy
sed -i "s/groovy/$codename/" sources.list
cp sources.list /etc/apt/sources.list
apt-get update
apt-get upgrade

# 下载软件 
echo "Y" | apt-get install vim zsh cmake python3-dev apt-transport-https
echo "Y" | apt-get purge firefox firefox-locale-en firefox-locale-zh-hans
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add -
apt install ./google-chrome-stable_current_amd64.deb
add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
echo "Y" | apt install code
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc


# 设置zsh
chsh -s /bin/zsh
sed -i "s/bash/zsh/" /etc/passwd

# 安装zsh插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
cp .zshrc ~/.zshrc
source ~/.zshrc

# 安装vim插件
mkdir ~/.vim
mkdir ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
cp .vimrc ~/.vimrc
cp vimrc /etc/vim/vimrc
